package com.dfbz.demo;

import java.io.ByteArrayInputStream;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_字节数组输入流 {
    public static void main(String[] args) throws Exception{

        byte[] data = {'a','b','c','d'};

        ByteArrayInputStream bais=new ByteArrayInputStream(data);

        System.out.println(bais.read());            // a
        System.out.println(bais.read());            // b

        bais.mark(1);

        System.out.println(bais.read());            // c
        System.out.println(bais.read());            // d

        bais.reset();

        System.out.println(bais.read());            // c
        System.out.println(bais.read());            // d

        bais.close();

    }
}
